package com.freesky.provider.content.controller;

import com.freesky.common.dao.entity.HomeNav;
import com.freesky.common.pojo.DataTablesResult;
import com.freesky.common.utils.reponse.JSONResponse;
import com.freesky.provider.content.service.IHomeNavigationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: 陈玉林
 * @modifiedBy:
 * @date: Create In 17:51 2018/12/12
 * @description:
 */
@RestController
public class HomeNavigationController {
    @Autowired
    private IHomeNavigationService homeNavigationService;
    @GetMapping(value ="/home/nav/list")
    public DataTablesResult list() {
        return homeNavigationService.list();
    }

    @DeleteMapping(value = "/home/nav/del/{ids}")
    public JSONResponse delete(@PathVariable("ids") int[] ids) {
        return homeNavigationService.delete(ids);
    }

    @PostMapping(value = "/home/nav/add")
    public JSONResponse add(@RequestBody HomeNav homeNav) {
        return homeNavigationService.add(homeNav);
    }

    @PostMapping(value = "/home/nav/update")
    public JSONResponse update(@RequestBody HomeNav homeNav) {
        return homeNavigationService.update(homeNav);
    }

    /**
     * 获取前台导航列表
     * @return
     */
    @GetMapping(value = "/home/nav/portal/list")
    public JSONResponse getPortalNavList() {
        return homeNavigationService.getPortalNavList();
    }
}
